/*
 * HelloWorldClient.java
 *
 * Created on July 9, 2007, 11:35 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;

/**
 *
 * @author alababi
 */
public class HelloWorldClient {
    public static void main(String[] args) {      
        //get the remote object from the registry
        try {
            System.out.println("Security Manager loaded");
            String url = "//localhost/SAMPLE-SERVER";
            HelloWorld remoteObject = (HelloWorld)Naming.lookup(url);
            System.out.println("Got remote object");
            System.out.println(remoteObject.sayHello(args[0]));
        } catch (RemoteException exc) {
            System.out.println("Error in lookup: " + exc.toString());
        } catch (java.net.MalformedURLException exc) {
            System.out.println("Malformed URL: " + exc.toString());
        } catch (java.rmi.NotBoundException exc) {
            System.out.println("NotBound: " + exc.toString());
        }
    }
}
